package com.ytjj.qmyx.supplychain.mapper;

import com.ytjj.qmyx.supplychain.common.model.ProductComputeVO;
import com.ytjj.qmyx.supplychain.common.model.request.ExpressOrderRequest;
import com.ytjj.qmyx.supplychain.common.model.request.ReturnGoodsRequest;
import com.ytjj.qmyx.supplychain.common.model.request.SalesStatisticalRequest;
import com.ytjj.qmyx.supplychain.common.model.response.*;
import com.ytjj.qmyx.supplychain.mapper.entity.YxExpressOrders;
import com.ytjj.qmyx.supplychain.mapper.entity.YxReturnGoods;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.math.BigDecimal;
import java.util.List;

public interface ReturnGoodsMapper extends Mapper<YxReturnGoods> {
    List<ReturnGoodsResponse> selectList(ReturnGoodsRequest request);

    List<ReturnGoodsResponse> selectAllList(ReturnGoodsRequest request);

    ReturnProductDetail getProductInfo(Integer id);

    ReturnOrdersDetail getOrdersInfo(Integer id);

    ReturnServiceDetail getServiceInfo(Integer id);

    ReturnBankerDetail getBankerInfo(Integer id);

    ReturnBankerDetail selectReturnGoodsBankerInfo(Integer id);

    ReturnGoodsTime getExpressInfo(Integer id);

    Integer auditSuccess(Integer id);

    Integer auditFail(@Param("id") Integer id, @Param("bankerRemarks") String bankerRemarks);

    Integer getReturnStatus(Integer id);

    BigDecimal getSpecPrice(@Param("productId") Integer productId, @Param("skuSpec") String skuSpec);

    Integer updateAddressIdById(@Param("id") Integer id, @Param("addressId") Integer addressId);

    YxReturnGoods selectById(Integer id);

    List<String> returningOrderList(@Param("bankerId") Integer bankerId);

//    List<String> returnRegisterOrderList(@Param("bankerId") Integer bankerId);

    Integer haveReturnGoodsRecord(Integer orderInfoId);

    Integer haveReturnRegisterRecord(Integer orderInfoId);

//    List<String> returnChildOrderNo(Integer orderInfoId);

    void updateStatus(Integer id);

    void auditFailByAfterType(@Param("id") Integer id, @Param("bankerRemarks")String bankerRemarks);

    List<YxReturnGoods> selectList2(@Param("bankerIds") List<Integer> bankerIds);

    List<ReturnBankerReceResponse> selectReceList();

    void updateBankerStatus(@Param("id") Integer id, @Param("status") Integer status);

    List<YxReturnGoods> selectListByStatus(@Param("status") Integer status);

    List<YxReturnGoods> selectListByStatusAndSerNo(@Param("status") Integer status);

    void updateExpressReceiveStatus(YxReturnGoods yxReturnGoods);

    List<YxReturnGoods> selectListByAfterTypeAndBankerStatus();

    List<YxReturnGoods> selectByBankerNotApproved();

    void updateBankerStatusAuto(Integer id);

    void updateBankerStatusAutoByBankerNotApproved(Integer id);

    void updateStatusByServiceNo(@Param("serviceNo") String serviceNo, @Param("status") Integer status,@Param("serviceDesc") String serviceDesc);

    List<ReturnGoodsResponse> selectReturnGoodsList(ReturnGoodsRequest request);

    List<YxReturnGoods> selectDateByOrderInfoIds(@Param("orderInfoIds") List<Integer> orderInfoIds);

    List<YxReturnGoods> selectDateByChildOrderNos(@Param("childOrderNos") List<String> childOrderNos);

    ProductComputeVO getReturnNumByToday();

    ProductComputeVO getReturnNumByYesterday();

    List<ProductComputeVO> getStatisticalByTopCategory(SalesStatisticalRequest request);

    List<ProductComputeVO> getReturnSuccessByTopCategory(SalesStatisticalRequest request);

    List<ProductComputeVO> getReturnByProduct(SalesStatisticalRequest request);

    List<ProductComputeVO> getReturnSuccessByProduct(SalesStatisticalRequest request);

    ProductComputeVO getCountReturnSuccess();

    ProductComputeVO getCountReturnSuccessYesterday();

    List<YxReturnGoods> selectByChildOrderNoList(@Param("list") List<String> childOrderNoList);

    List<YxReturnGoods> selectInvalidList();

    List<String> selectByStatus();

    void updateLinkServiceNo(@Param("refundOrderCode") String refundOrderCode, @Param("serviceNo") String serviceNo);

    int updateBankerStatusByLink(@Param("serviceNo") String serviceNo);

    List<YxExpressOrders> selectExpressOrders(ExpressOrderRequest request);

    Integer updateByServiceNo(YxReturnGoods returnGoods);

    int updateExpressRecord(@Param("serviceNo") String serviceNo,@Param("expressRecord")String expressRecord,@Param("expressText")String expressText);

    /**
     * 获得需要修复的订单数据
     */
    List<YxReturnGoods> getUnrepairData();
}
